/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import logo from '@/assets/logo.svg'; // 快宝logo
// 中邮图片
import logoPost from '@/assets/logo-post.png';
import loginBgPost from '@/assets/login-bg-post.png';
import logoYjy from '@/assets/logo-yjy.png';
import loginBgYjy from '@/assets/login-bg-yjy.png';
import { defaultBgUrl } from './defaultSettings';

// 动态设置icon
function setIcon(href) {
  const link = document.querySelector("link[rel*='icon']") || document.createElement('link');
  link.type = 'image/x-icon';
  link.rel = 'shortcut icon';
  link.href = href;
  document.getElementsByTagName('head')[0].appendChild(link);
}

const options = (opts => ({
  key: 'yz',
  name: '快宝智慧快递管理平台',
  copyright: '快宝（上海）网络技术有限公司',
  recordNo: '沪公网安备 31010502000130号',
  logo,
  loginBg: {
    url: defaultBgUrl,
    height: 388,
  },
  recruitUrl: 'https://www.kuaidihelp.com/index/joinStation',
  appUrl: '//www.kuaidihelp.com/index/station',
  favicon: '/dist/favicon.png',
  primaryColor: '#1890FF',
  topAccountTitle: '快宝公司',
  deleteParentMenu: ['数据开放平台', '快宝云店', '智能硬件'],
  deleteMenu: [
    '/Allocation/AuthorityManagement', // 中邮总账号共配权限管理
    '/post/bigScreen', // 中邮大屏
  ],
  hideWhileNoAuth: ['fund', 'business', 'delivery', 'allocation/authSet', 'automatic'],
  // 非公司层级片区，需要隐藏的菜单
  zoneDelete: [
    '/post/dispat',
    '/post/express',
    '/post/complantBlackList',
    '/post/setup',
    '/post/bigData',
    '/Allocation/fastMsg',
    '/Allocation/DataStatistics',
    '/Allocation/Dispat',
    '/Allocation/DataMonitor',
    '/Allocation/OperatorKanban',
    '/Allocation/CustomScan',
    '/Allocation/AuthorityManagement',
    '/Allocation/PrintKey',
    '/system/business/station',
    '/system/info',
    '/system/business/client',
  ],
  showAdv: true,
  ...opts[window.location.hostname],
}))({
  'gp.chinapostcnps.com': {
    key: 'post',
    name: '中邮共配管理系统',
    copyright: '中邮驿站',
    recordNo: '浙ICP备19022586号-2',
    logo: logoPost,
    loginBg: {
      url: loginBgPost,
      height: 388,
    },
    recruitUrl: '',
    appUrl: 'http://renew.kuaidihelp.com/rn/postman.apk',
    favicon: '/dist/favicon-post.png',
    primaryColor: '#b8d637',
    topAccountTitle: '中邮总公司',
    deleteParentMenu: ['数据开放平台', '快宝云店', '智能硬件'],
    deleteMenu: [
      '/order/derivativeRecord', // 微商单号记录
      '/post/setup', // 设置管理
      '/system/business/station', // 站点
      '/system/business/Derivative', // 微商管理
      '/Allocation/Dispat', // 派费直发
      '/Allocation/DataMonitor', // 共配数据监控
    ],
    hideWhileNoAuth: [
      'fund',
      'business',
      'delivery',
      'automatic', // 自动化页面
      'allocation/authSet', // 共配权限管理
      'allocation/postOption', // 巴枪扫描配置
      'allocation/fastMsg', // 快件信息下发
      'allocation/customScan', // 自定义扫描
      'allocation/statistics', // 共配数据统计
    ],
    showAdv: false,
  },
  'yikuaisaoplus.hehengjia.com': {
    key: 'yjy',
    name: '驿加易共配管理系统',
    copyright: '驿加易',
    recordNo: '浙ICP备19022586号-2',
    logo: logoYjy,
    loginBg: {
      url: loginBgYjy,
      height: 388,
    },
    recruitUrl: '',
    appUrl: '',
    favicon: '/dist/favicon-yjy.png',
    primaryColor: '#b8d637',
    topAccountTitle: '驿加易总公司',
    deleteParentMenu: ['数据开放平台', '快宝云店', '智能硬件'],
    deleteMenu: [
      '/order/derivativeRecord', // 微商单号记录
      '/post/setup', // 设置管理
      '/system/business/client', // 客户管理
      '/system/business/Derivative', // 微商管理
      '/Allocation/DataStatistics', // 共配，数据统计
      '/Allocation/Dispat', // 派费直发
      '/Allocation/DataMonitor', // 共配数据监控
    ],
    hideWhileNoAuth: [
      'business',
      'delivery',
      'system',
      'orders',
      'platform',
      'post',
      'fund',
      'automatic',
      'allocation/authSet',
      'allocation/postOption',
      'allocation/fastMsg',
      'allocation/customScan',
      'allocation/statistics',
      'allocation/printKey',
    ],
    showAdv: false,
  },
  'city.tongdiyiyou.com': {
    key: 'yz',
    subKey: 'td',
    name: '智慧快递管理平台',
    copyright: '上海通递驿优网络技术有限公司 沪ICP备19008188号-1',
    recordNo: '',
    logo,
    loginBg: {
      url: defaultBgUrl,
      height: 388,
    },
    recruitUrl: '',
    appUrl: '',
    favicon: '/dist/favicon.png',
    primaryColor: '#1890FF',
    deleteParentMenu: ['快宝共配', '自动化', '快宝同城', '即时配送', '工单系统', '财务管理'],
    hideWhileNoAuth: [],
    showAdv: true,
  },
});

setIcon(options.favicon);

module.exports = {
  options,
};
